package com.bosssoft.trainee.controller;

import com.bosssoft.trainee.common.Result;
import com.bosssoft.trainee.entity.VO.InfoUserVO;
import com.bosssoft.trainee.service.UserInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @author liuqiang
 * @date 2022/7/13 14:55
 */
@RestController
@Slf4j
public class UserInfoController {

    @Autowired
    private UserInfoService userInfoService;

    @GetMapping(value = "/userInfo/find/{id}")
    public Result<Object> findUser(@PathVariable("id") Integer id) {
        return userInfoService.findUserInfo(id);
    }

    @GetMapping("/userRole/register/roleList")
    Result<Object> getRegisterRole(){
        return userInfoService.getRegisterRole();
    }

    @PostMapping("/userInfo/register")
    Result<Object> insertUser(@Valid @RequestBody InfoUserVO infoUserVo){
        return userInfoService.insertUser(infoUserVo);
    }
}
